{layout name="p/base"}
  <div id="page-wrapper">
    <div class="row">
      <div class="col-lg-12">
        <h1>管理员管理 <small>管理员信息列表</small></h1>
        <ol class="breadcrumb">
          <li><a href="index.php"><i class="fa fa-dashboard"></i> 管理首页</a></li>
          <li><a href="/campmanagerlist"><i class="fa fa-dashboard"></i> 管理员信息列表</a></li>
          <li class="active"><i class="fa fa-table"></i> 添加管理员</li>
        </ol>
        <div class="alert alert-success alert-dismissable">
          <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
          这里可以添加、修改、删除管理员信息
        </div>
      </div>
    </div>
    <!-- /.row -->
    <div class="row">
      <div class="col-lg-12">
          <form class="form-horizontal" role="form" action="/campmanagerlist" method="post">
            <div class="modal-header">
              <button type="button" class="close" 
                 data-dismiss="modal" aria-hidden="true">
                    &times;
              </button>
              <h4 class="modal-title" id="myModalLabel">
                 添加管理员信息
              </h4>
            </div>
            <div class="modal-body">
              <div class="form-group">
                <label class="control-label col-sm-3">管理员姓名</label>
                <div class="col-sm-9">
                <input class="form-control" type="text" name="name" placeholder="请填写管理员真实姓名">
                </div>
              </div>
              <div class="form-group">
                <label class="control-label col-sm-3"><span id="phoneerror">管理员手机号</label>
                <div class="col-sm-9">
                <input class="form-control" type="text" name="phone" placeholder="请填写管理员手机号">
                </div>
              </div>
              <div class="form-group">
                <label class="control-label col-sm-3">管理员密码</label>
                <div class="col-sm-9">
                <input class="form-control" type="text" name="password" placeholder="请填写管理员密码">
                </div>
              </div>
              <div class="form-group">
                <label class="control-label col-sm-3"><span id="emailerror">邮箱地址</label>
                <div class="col-sm-9">
                  <input class="form-control" type="text" name="email" placeholder="请填写邮箱地址">
                </div>
              </div>
              
            </div>
            <div class="modal-footer">
              <input type="button" value="返回" class="btn btn-default"  onclick="javascript:history.back(-1);" />
              <button type="submit" class="btn btn-primary">
                 提交
              </button>
            </div>
          </form>
      </div>
      
    </div>
    <!-- /.row -->
    
  </div><!-- /#page-wrapper -->

<script type="text/javascript" src="/jquery.js"></script>
<script src="/front/js/js.js"></script>
<script type="text/javascript">
  $(function(){
    //账号验证
    $("input[name='phone']").blur(function(){
      var phone = $('input[name="phone"]').val();
      //不能为空
      if(!$.trim(phone)) {
      $("input[name='phone']").css({border: "1px solid red"});
      $("#phoneerror").html("请输入手机号");
      return false;
      }
      //手机号格式是否满足
      if((/^1[3|4|5|7|8]\d{9}$/.test(phone)) || (/(^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+$)|(^$)/.test(phone))){
        $("input[name='phone']").css({border: "1px solid green"});
        $("#phoneerror").html("管理员手机号");
      }else {
        $("input[name='phone']").css({border: "1px solid red"});
        $("#phoneerror").html("格式不正确");
        return false;
      }
    })
    //邮箱账号验证
    $("input[name='email']").blur(function(){
      var email = $('input[name="email"]').val();
      //不能为空
      if(!$.trim(email)) {
      $("input[name='email']").css({border: "1px solid red"});
      $("#emailerror").html("请输入邮箱");
      return false;
      }
      //邮箱格式是否满足
      if(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(email)){
        $("input[name='email']").css({border: "1px solid green"});
        $("#emailerror").html("邮箱地址");
      }else {
        $("input[name='email']").css({border: "1px solid red"});
        $("#emailerror").html("格式不正确");
        return false;
      }
    })
  })
</script>